package com.fjwt.gz.service.other.export;

import com.fjwt.gz.db.dto.FansAuthDTO;
import com.fjwt.gz.db.entity.SysExportTaskEntity;
import com.fjwt.gz.db.vo.ExportAwardVO;
import com.fjwt.gz.service.activity.AbstractExportReport;
import com.fjwt.gz.service.impl.FansAwardService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * ------ 邀请助力活动导出报表
 */
@Slf4j
@Service
public class RealExportReport extends AbstractExportReport<ExportAwardVO> {

    @Autowired
    private FansAwardService fansAwardService;


    private static final Map<String, String> headerAliasMap = new HashMap<>();
    static {
        headerAliasMap.put("fansId", "用户唯一ID");
        headerAliasMap.put("cstmNo", "信息局唯一标识");
        headerAliasMap.put("createdAt", "实名时间");
        headerAliasMap.put("agentNo", "归属机构");
    }


    public String exportActivityExcel(SysExportTaskEntity sysExportTaskEntity) {
        FansAuthDTO fansAuthDTO = getRequestParam(sysExportTaskEntity.getRequestParam(), FansAuthDTO.class);
        List<ExportAwardVO> list = fansAwardService.exportReal(fansAuthDTO);
        return createExcelAndUploadOssUrl(list, headerAliasMap, sysExportTaskEntity);
    }
}
